package com.chonglie;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Gallery;
import android.widget.ImageView;

import com.chonglie.gallery.ImageAdapter;

public class GalleryActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.gallery);

		Gallery gallery = (Gallery) findViewById(R.id.gallery);
		gallery.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				ImageView imageView = (ImageView) view;
				int[] size = new int[2];
				size[0] = imageView.getWidth() * 2;
				size[1] = imageView.getHeight() * 2;
				imageView.setLayoutParams(new Gallery.LayoutParams(size[0],
						size[1]));

			}
		});

		gallery.setAdapter(new ImageAdapter(this));
	}

}
